/**
 * @Author Stringzhua
 * @Date 2024/1/16 17:13
 * description:三元运算符使用细节
 */
public class TernaryOperatorDetail {
    public static void main(String[] args) {
        //表达式1和表达式2要为可以赋给接收变量的类型(或可以自动转换)
        int a = 3;
        int b = 8;
        int c = a > b ? (int) 1.1 : (int) 3.4;//可以的
        double d = a > b ? a : b + 3;//可以的,满足int-->double
        System.out.println("a = " + a);//3
        System.out.println("b = " + b);//8
        System.out.println("c = " + c);//3
        System.out.println("d = " + d);//11.0
    }
}